from import_export.widgets import ForeignKeyWidget
from apps.rms.models import ProtocolType


class ProtocolTypeForeignKeyWidget(ForeignKeyWidget):
    def get_queryset(self, value, row, *args, **kwargs):
        return ProtocolType.objects.filter(name=row['protocol'], product__name=row['product'])
